package com.infra.micro.id.api;

import com.infra.common.resp.Response;
import com.infra.micro.id.fallback.IdHealthApiFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Set;

@Component
@FeignClient(value = "micro-id-service", path = "/api/id/snowflake", fallbackFactory = IdHealthApiFallback.class)
public interface IdSnowflakeApi {
    @GetMapping("/{appId}")
    Response<Long> getId(@PathVariable("appId") Integer appId);

    @GetMapping("/{appId}/{step}")
    Response<Set<Long>> getId(@PathVariable("appId") Integer appId, @PathVariable("step") int step);
}
